package com.umgsai.thread.thread11;

import java.util.ArrayList;
import java.util.List;


public class MyList {
	private List list = new ArrayList();
	synchronized public void add(String username) {
		System.out.println(Thread.currentThread().getName() + " start to execute add()");
		list.add(username);
		System.out.println(Thread.currentThread().getName() + " finished executing add()");
	}
	
	synchronized public int getSize() {
		System.out.println(Thread.currentThread().getName() + " start to execute getSize()");
		int size = list.size();
		System.out.println(Thread.currentThread().getName() + " finished executing getSize()");
		return size;
	}
}
